class TodoView {
    constructor(rootElement) {
        this.rootElement = rootElement;
        this.todoListElement = document.createElement('ul');
        this.rootElement.appendChild(this.todoListElement);
    }

    render(todos) {
        this.todoListElement.innerHTML = '';
        todos.forEach(todo => {
            const li = document.createElement('li');
            li.textContent = todo.text;
            if (todo.completed) {
                li.classList.add('completed');
            }
            this.todoListElement.appendChild(li);
        });
    }
}